package com.xoa.service.document;

import com.xoa.model.department.Department;
import com.xoa.model.document.DocumentModel;
import com.xoa.model.document.DocumentModelFlowRunPrcs;
import com.xoa.model.document.DocumentModelWithBLOBs;
import com.xoa.model.document.SysRuleModel;
import com.xoa.model.users.Users;
import com.xoa.util.ToJson;
import com.xoa.util.common.wrapper.BaseWrappers;
import com.xoa.util.page.PageParams;

import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.List;

public interface DocumentSerivce {
	public static final Integer PRCS_FLAG_WILL=1;
	public static final Integer PRCS_FLAG_OVER=2;

	/**
	 *
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-6-13 下午8:16:48
	 * 方法介绍:   保存公文
	 * 参数说明:   @param sysRule
	 * 参数说明:   @return
	 * @return     int
	 */
	int saveSysRule(SysRuleModel sysRule);
	/**
	 *
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-6-14 下午8:10:45
	 * 方法介绍:   删除一条公文信息
	 * 参数说明:   @param sysRule
	 * 参数说明:   @return
	 * @return     int
	 */
	int deleteSysRule(SysRuleModel sysRule);
	/**
	 *
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-6-14 下午8:14:15
	 * 方法介绍:   编辑公文规则
	 * 参数说明:   @param sysRule
	 * 参数说明:   @return
	 * @return     int
	 */
	int updateRuleById(SysRuleModel sysRule);

	/**
	 * 修改公文文号
	 * @param sysRuleModel
	 * @return
	 */
	int updateRunIdById(SysRuleModel sysRuleModel);
	/**
	 *
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-6-14 下午8:20:26
	 * 方法介绍:   通过id获取一条数据
	 * 参数说明:   @param sysRule
	 * 参数说明:   @return
	 * @return     SysRuleModel
	 */
	SysRuleModel getRuleById(SysRuleModel sysRule,HttpServletRequest request);
	/**
	 *
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-6-14 下午8:25:03
	 * 方法介绍:   获取全部公文设置生成规则
	 * 参数说明:   @param sysRule
	 * 参数说明:   @return
	 * @return     List<SysRuleModel>
	 */
	List<SysRuleModel> getRuleAll(SysRuleModel sysRule,HttpServletRequest request);

	List<SysRuleModel> getRuleAll2(SysRuleModel sysRule,HttpServletRequest request);

	/**
	 * 创建作者:   张航宁
	 * 创建日期:   2017-7-14
	 * 方法介绍:   根据code获取单个信息
	 * 参数说明:   @param sysRule
	 */
	SysRuleModel getRuleByCode(SysRuleModel sysRule);

	ToJson<Object> saveDocument(Users user, Integer fflowId, Integer fflowStep, String fprcsId, String frunName, DocumentModelWithBLOBs document,HttpServletRequest request);

	ToJson<Object> saveDocument2(Users user, Integer fflowId, Integer fflowStep, String fprcsId, String frunName, DocumentModelWithBLOBs document,HttpServletRequest request,String fromRunId,String attachmentId,String attachmentName);


	int deleteDocument(DocumentModelWithBLOBs document);

	int updateDocument(DocumentModelWithBLOBs document);

	DocumentModelWithBLOBs selectDocumentById(HttpServletRequest request,DocumentModelWithBLOBs document);
	/**
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-7-26 下午6:05:25
	 * 方法介绍:   
	 * 参数说明:   @param document
	 * 参数说明:   @return
	 * @return     List<DocumentWithBLOBs>
	 */
	List<DocumentModelWithBLOBs> selectDocAll(DocumentModelWithBLOBs document);


	ToJson<DocumentModelWithBLOBs> seleDocSendReceive(String documentType,String curUserID,String allUserID,String dispatchType,String printDate,
													  HttpServletRequest request,
													  Integer page,
													  Integer pageSize,
													  Boolean useFlag);
	/**
	 * 创建作者:   杨 胜
	 * 创建日期:   2017-7-28 上午11:03:55
	 * 方法介绍:   
	 * 参数说明:   @param document
	 * 参数说明:   @param request
	 * 参数说明:   @return
	 * @return     DocumentModelWithBLOBs
	 */
	BaseWrappers selectDocSelective( Integer documentType,
									 String title,
									 Integer flowId,
									 String dispatchType,
									 String urgency,
									 String secrecy,
									 String userId,
									 String deptId,
									 String createTim,
									 Integer status, PageParams pageParams,
									 HttpServletRequest request,Integer runId);

	BaseWrappers selWillDocSendOrReceive(HttpServletRequest request, String documentType, String dispatchType, String printDate,String title,Integer docStatus, Integer page, Integer pageSize,Integer prcsFlag,String state,String beginTime,String endTime);

	BaseWrappers selOverDocSendOrReceive(HttpServletRequest request, String documentType, String dispatchType, String printDate,String title,Integer docStatus, Integer page, Integer pageSize,Integer prcsFlag);

	BaseWrappers selMyDocument(HttpServletRequest request, String documentType, String dispatchType, String printDate,String title,Integer docStatus, Integer page, Integer pageSize,Integer prcsFlag);

	BaseWrappers selMyDocSendOrReceive(HttpServletRequest request, String documentType, String dispatchType, String printDate,String title,Integer docStatus, Integer page, Integer pageSize);

	BaseWrappers selOverseeTheOfficialDocument(HttpServletRequest request, String documentType, String dispatchType,String computationNumber,Integer page, Integer pageSize,
											   Boolean useFlag,String printDate,String title);

	BaseWrappers addDocSendSms(HttpServletRequest req,String cuName,String allName,String title,String classify,String flowId,String prcsId,String flowStep,String runId ,String opFlag);

	/**
	 * @作者：张航宁
	 * @时间：2017/8/9
	 * @介绍：查询编辑状态是否可以编辑
	 * @参数：id
	 */
	ToJson<DocumentModel> getDocumentEditPriv(Integer id);

	/**
	 * 作者: 张航宁
	 * 日期: 2017/9/26
	 * 说明: 查询有时限的公文信息
	 */
	BaseWrappers selectTimeOutDoc(HttpServletRequest request);

	BaseWrappers<DocumentModelFlowRunPrcs> selDocByTitle(HttpServletRequest request, String title, PageParams pageParams);

	DocumentModel checkRunId(Integer runId);
	//查询未使用的文号
	public ToJson unUseNo(HttpServletRequest request, SysRuleModel sysRuleModel, Integer flowId);
	//查询已使用的文号
	public ToJson UseNo(HttpServletRequest request, Integer flowId);
	//查询flow_data_x是否存在此条runid
	public ToJson checkRunId(HttpServletRequest request,Integer flowId, Integer runId);
	//查询出count+1的数据
	SysRuleModel getRuleByIds(SysRuleModel sysRule,HttpServletRequest request,Integer count);
	//查询公文门户的统计数量
	public ToJson selectCount(HttpServletRequest request);
	//公文门户e-char图数据
	public ToJson selectWillCount(HttpServletRequest request);
	//公文门户e-char图数据
	public ToJson selectBytypeCount(HttpServletRequest request);
	//获取自定义规则样式
	public String rule(String expressionStr);
	//直接上传pdf后将其他三个正文字段数据清除
	ToJson setMainFile(Integer id);
	//直接上传word文件后将pdf和修订文件对应的字段清除
	public ToJson clearMainpdf(Integer id);
	//电建门户公文管理待办数据获取
	BaseWrappers getAssignDocData(HttpServletRequest request, String documentType, String dispatchType, String printDate,String title,Integer docStatus, Integer page, Integer pageSize,Integer prcsFlag);

	ToJson SupervisionStatistics(HttpServletRequest request, Integer page, Integer pageSize, Integer flowId, String flag) throws ParseException;

	//督办流程发送事务提醒
	public void sendSms();

	public Integer updateDocumentTitle(String title,  Integer runId);
}
